package models;

import java.util.*;
import javax.persistence.*;

import play.db.ebean.*;
import play.data.format.*;
import play.data.validation.*;

import com.avaje.ebean.*;

/**
 * Trip entity managed by Ebean
 */
@Entity  
@Table(name="trips")
public class Trip extends Model {

    @Constraints.Required
    public String route_id;
    
    @Constraints.Required
    public String service_id;
    
    @Id
    public String trip_id;
    
    public String trip_headsign;
    
    public String direction_id;
    
    public String block_id;
    
    public String shape_id;
    
    public static Model.Finder<String,Trip> find = new Model.Finder(String.class, Trip.class);
    
    /**
     * Retrieve all StopTimes.
     */
    public static List<Trip> findAll() {
        return find.all();
    }
    
    /**
     * Retrieve Route.
     */
    public Route findRoute() {
        return Route.find
            .where()
            .eq("route_id", this.route_id)
            .findUnique();
    }

}

